home *** CD-ROM | disk | FTP | other *** search
- *
- * Main.asm - Hauptprogramm des C64-Emulators/Einstellungsfenster
- *
- * Copyright (C) 1994-1995 by Christian Bauer
- *
-
- MACHINE 68020
-
- INCLUDE "exec/types.i"
- INCLUDE "exec/macros.i"
- INCLUDE "exec/memory.i"
- INCLUDE "exec/execbase.i"
- INCLUDE "dos/dos.i"
- INCLUDE "dos/dosextens.i"
- INCLUDE "intuition/intuition.i"
- INCLUDE "intuition/intuitionbase.i"
- INCLUDE "libraries/locale.i"
- INCLUDE "workbench/startup.i"
- INCLUDE "devices/timer.i"
- INCLUDE "Frodo_rev.i"
- CATCOMP_NUMBERS = 1
- INCLUDE "LocStrings.i"
-
- XREF _SysBase ;AStartup
- XREF _DOSBase
- XREF _WBenchMsg
- XDEF _main
-
- XDEF _UtilityBase
- XDEF _IntuitionBase
- XDEF _GfxBase
- XDEF _GadToolsBase
- XDEF _AslBase
- XDEF _IconBase
- XDEF _CyberGfxBase
- XDEF _CiaBase
- XDEF _MiscBase
- XDEF _SID6581Base
- XDEF _PlaySidBase
- XDEF _TimerBase
-
- XDEF MainTask
- XDEF _ShowPrefs
- XDEF Random
- XDEF ResetC64
-
- XREF _DoThePrefs ;Prefs.c
- XREF _LocalizePrefs
- XREF _OpenPrefs
-
- XREF _OpenDisplay ;Display.c
- XREF _CloseDisplay
- XREF _EmulToBack
- XREF _EmulToFront
- XREF _EventLoop
- XREF _LocalizeDisplay
-
- XDEF TheLocale ;Strings.o
- XREF GetString
-
- XREF TheRAM ;6510.asm
- XREF TheBasic
- XREF TheKernal
- XREF TheChar
- XREF TheColor
- XREF Init6510
- XREF Reset6510
- XREF Start6510
- XREF Stop6510
- XREF Wait6510
- XREF Pause6510
- XREF Resume6510
- XREF Localize6510
-
- XREF Reset6526 ;6526.asm
- XREF ChangedKeys
- XREF CIACycles
- XREF Joystick1On
- XREF Joystick2On
- XREF JoystickSwap
- XREF KeyboardYZ
-
- XREF Init6569 ;6569.asm
- XREF OpenGraphics
- XREF DisplayID
- XREF ScreenType
- XREF NormalCycles
- XREF BadLineCycles
- XREF Collisions
- XREF Overscan
- XREF SkipLatch
- XREF LimitSpeed
- XREF DirectVideo
-
- XREF Reset6581 ;6581.asm
- XREF InitSID
- XREF ExitSID
- XREF ChangedSIDPrefs
- XREF PauseSound
- XREF ResumeSound
- XREF SIDType
-
- XREF InitIEC ;IEC.asm
- XREF ExitIEC
- XREF ChangedIECPrefs
- XREF Dir8
- XREF Dir9
- XREF Dir10
- XREF Dir11
- XREF Drv8Type
- XREF Drv9Type
- XREF Drv10Type
- XREF Drv11Type
- XREF OtherIEC
- XREF MapSlash
-
- XDEF PDir8 ;Für ChangedIECPrefs
- XDEF PDir9
- XDEF PDir10
- XDEF PDir11
- XDEF PDrv8Type
- XDEF PDrv9Type
- XDEF PDrv10Type
- XDEF PDrv11Type
-
- SECTION "text",CODE
-
-
- **
- ** Definitionen
- **
-
- ; Laufwerkstypen
- DRVTYPE_DIR = 0
- DRVTYPE_D64 = 1
- DRVTYPE_IEC = 2
-
-
- **
- ** Hauptprogramm
- **
-
- MACHINE 68000
-
- *
- * Libraries öffnen
- *
-
- ; Task holen
- _main move.l _SysBase,a6
- sub.l a1,a1
- JSRLIB FindTask
- move.l d0,MainTask
-
- ; Libraries öffnen
- moveq #37,d0
- lea UtilityName,a1
- JSRLIB OpenLibrary
- move.l d0,_UtilityBase
- beq NoUtility
-
- moveq #37,d0
- lea IntuiName,a1
- JSRLIB OpenLibrary
- move.l d0,_IntuitionBase
- beq NoIntui
-
- moveq #37,d0
- lea GfxName,a1
- JSRLIB OpenLibrary
- move.l d0,_GfxBase
- beq NoGfx
-
- moveq #37,d0
- lea GadToolsName,a1
- JSRLIB OpenLibrary
- move.l d0,_GadToolsBase
- beq NoGadTools
-
- moveq #38,d0
- lea AslName,a1
- JSRLIB OpenLibrary
- move.l d0,_AslBase
- beq NoAsl
-
- moveq #37,d0
- lea IconName,a1
- JSRLIB OpenLibrary
- move.l d0,_IconBase
- beq NoIcon
-
- moveq #40,d0
- lea CyberGfxName,a1
- JSRLIB OpenLibrary
- move.l d0,_CyberGfxBase
-
- moveq #0,d0
- lea SID6581Name,a1
- JSRLIB OpenLibrary
- move.l d0,_SID6581Base
-
- moveq #1,d0
- lea PlaySidName,a1
- JSRLIB OpenLibrary
- move.l d0,_PlaySidBase
-
- lea CiaResName,a1
- JSRLIB OpenResource
- move.l d0,_CiaBase
- beq NoCiaRes
-
- lea MiscResName,a1
- JSRLIB OpenResource
- move.l d0,_MiscBase
-
- lea TimerName,a0
- moveq #UNIT_MICROHZ,d0
- lea TimerIO,a1
- moveq #0,d1
- JSRLIB OpenDevice
- move.l TimerIO+IO_DEVICE,_TimerBase
- beq NoTimerDev
-
- ; Locale öffnen und Catalog laden
- move.l _SysBase,a6
- moveq #37,d0
- lea LocaleName,a1
- JSRLIB OpenLibrary
- move.l d0,_LocaleBase
- beq 10$
- move.l d0,a6
- sub.l a0,a0
- lea CatalogName,a1
- lea CatalogTags,a2
- JSRLIB OpenCatalogA
- move.l d0,TheCatalog
-
- ; Datenstrukturen lokalisieren
- 10$ bsr Localize
- jsr Localize6510
- jsr _LocalizePrefs
- jsr _LocalizeDisplay
-
- *
- * 68020+ vorhanden?
- *
-
- move.l _SysBase,a0
- move.w AttnFlags(a0),d0
- btst #AFB_68020,d0
- beq No68020Exit
-
- MACHINE 68020
-
- *
- * Argumente auswerten
- *
-
- ; Default-Name der Prefs-Datei setzen
- lea PrefsDefName,a0
- lea PrefsName,a1
- move.w #255,d0
- 1$ move.b (a0)+,(a1)+
- dbeq d0,1$
-
- ; Vom CLI gestartet?
- move.l MainTask,a0
- tst.l pr_CLI(a0)
- beq FromWB
-
- ; Ja, ReadArgs benutzen
- FromCLI move.l _DOSBase,a6
- move.l #Template,d1
- move.l #CLIArgs,d2 ;Erstes Argument
- moveq #0,d3
- JSRLIB ReadArgs
- move.l d0,d1 ;NULL ist OK
-
- move.l PrefsNameArg,d0 ;Name der Prefs-Datei kopieren
- beq 1$
- move.l d0,a0
- lea PrefsName,a1
- move.w #255,d0
- 2$ move.b (a0)+,(a1)+
- dbeq d0,2$
-
- 1$ JSRLIB FreeArgs
- bra ArgsDone
-
- ; Von der Workbench gestartet, erstes Icon als Prefs laden
- FromWB move.l _WBenchMsg,a0
- cmp.l #1,sm_NumArgs(a0)
- bls ArgsDone
-
- move.l sm_ArgList(a0),a0
- lea wa_SIZEOF(a0),a0 ;Erstes Icon (wir selbst) überspringen
-
- move.l wa_Lock(a0),d1
- beq ArgsDone
- move.l wa_Name(a0),d4
-
- move.l _DOSBase,a6
- move.l #PrefsName,d2
- move.l #256,d3
- JSRLIB NameFromLock
-
- move.l #PrefsName,d1
- move.l d4,d2
- move.l #256,d3
- JSRLIB AddPart
- ArgsDone
-
- *
- * Einstellungen laden
- *
-
- ; Vorgegebene Einstellungen
- move.w #63,PNormalCycles
- move.w #23,PBadLineCycles
- move.w #63,PCIACycles
- move.w #-1,PJoystick2On
- move.w #-1,PCollisions
- move.w #-1,PMapSlash
- move.w #-1,PFastReset
- move.w #OSCAN_TEXT,POverscan
- move.w #1,PSkipLatch
-
- ; Einstellungen laden
- pea ThePrefs
- jsr _OpenPrefs
- addq.l #4,sp
-
- *
- * Einstellungsfenster
- *
-
- ; Einstellungsfenster darstellen
- clr.w PrefsFromEmul
- pea ThePrefs
- jsr _DoThePrefs
- addq.l #4,sp
-
- ; Einstellungen übernehmen, wenn OK geklickt, sonst beenden
- tst.l d0
- beq Exit
- bsr SetPrefs
-
- ; IEC-Bus vorbereiten
- jsr InitIEC
- bsr IECErrorReq
-
- ; SID-Emulation vorbereiten
- jsr InitSID
-
- *
- * Emulation initialisieren
- *
-
- ; Zufallszahlengenerator initialisieren
- move.l _IntuitionBase,a0
- move.l ib_Micros(a0),RandomSeed
-
- ; Speicher für alles holen (die unteren Worte müssen mit den C64-Adressen
- ; übereinstimmen, außer CharROM)
- move.l _SysBase,a6
- move.l #$30000,d0 ;192K
- move.l #MEMF_ANY|MEMF_CLEAR,d1
- JSRLIB AllocVec
- move.l d0,RAMBlock
- beq NoMemExit
-
- add.l #$ffff,d0 ;Auf xxxx0000 bringen
- clr.w d0
- move.l d0,TheRAM
- add.l #$11000,d0
- move.l d0,TheChar ;yyyy1000
- add.l #$9000,d0
- move.l d0,TheBasic ;yyyya000
- add.l #$3800,d0
- move.l d0,TheColor ;yyyyd800
- add.l #$0800,d0
- move.l d0,TheKernal ;yyyye000
-
- ; Opcodes $d2 (Wraparound) ab $10000 installieren,
- ; für den Fall, daß ein Programm über $ffff springt
- move.l TheRAM,a0
- lea $10000(a0),a0
- moveq #256/4-1,d0
- 10$ move.l #$d2d2d2d2,(a0)+
- dbra d0,10$
-
- ; ROMs laden
- move.l _DOSBase,a6
- move.l #BasicFileName,d1 ;Basic
- move.l #MODE_OLDFILE,d2
- JSRLIB Open
- move.l d0,d7
- beq NoBasicExit
- move.l d0,d1
- move.l TheBasic,d2
- move.l #$2000,d3
- JSRLIB Read
- move.l d7,d1
- JSRLIB Close
-
- move.l #KernalFileName,d1 ;Kernal
- move.l #MODE_OLDFILE,d2
- JSRLIB Open
- move.l d0,d7
- beq NoKernalExit
- move.l d0,d1
- move.l TheKernal,d2
- move.l #$2000,d3
- JSRLIB Read
- move.l d7,d1
- JSRLIB Close
-
- move.l #CharFileName,d1 ;Char
- move.l #MODE_OLDFILE,d2
- JSRLIB Open
- move.l d0,d7
- beq NoCharExit
- move.l d0,d1
- move.l TheChar,d2
- move.l #$1000,d3
- JSRLIB Read
- move.l d7,d1
- JSRLIB Close
-
- ; Betriebssystem patchen
- move.l TheKernal,a0
- move.w #$f200,$0d40(a0) ;IECOut
- move.w #$f201,$0d23(a0) ;IECOutATN
- move.w #$f202,$0d36(a0) ;IECOutSec
- move.w #$f203,$0e13(a0) ;IECIn
- move.w #$f204,$0def(a0) ;IECSetATN
- move.w #$f205,$0dbe(a0) ;IECRelATN
- move.w #$f206,$0dcc(a0) ;IECTurnaround
- move.w #$f207,$0e03(a0) ;IECRelease
- bsr PatchReset
-
- ; Bildschirm öffnen
- jsr OpenGraphics
- cmp.l #1,d0
- beq NoScreenExit
- cmp.l #2,d0
- beq NoMemExit
-
- ; Alles initialisieren
- jsr Reset6526
- jsr Reset6581
- jsr Init6510
- jsr Init6569
-
- ; 6510 starten
- jsr Start6510
- tst.l d0
- bne NoMemExit
-
- ; IDCMP des Fensters handhaben
- jsr _EventLoop
-
- ; Programm beenden
- bra Exit
-
- *
- * Fehlerbehandlung/Beenden
- *
-
- MACHINE 68000
-
- No68020Exit moveq #MSG_NO68020,d0
- lea TheLocale,a0
- jsr GetString
- lea ErrorReq,a1
- move.l d0,es_TextFormat(a1)
- sub.l a0,a0
- sub.l a2,a2
- sub.l a3,a3
- move.l _IntuitionBase,a6
- JSRLIB EasyRequestArgs
- bra NoCiaRes
-
- MACHINE 68020
-
- NoMemExit moveq #MSG_NOMEM,d0
- bra ReqExit
-
- NoScreenExit moveq #MSG_NOSCREEN,d0
- bra ReqExit
-
- NoKernalExit moveq #MSG_NOKERNAL,d0
- bra ReqExit
-
- NoBasicExit moveq #MSG_NOBASIC,d0
- bra ReqExit
-
- NoCharExit moveq #MSG_NOCHAR,d0
-
- ReqExit lea TheLocale,a0
- jsr GetString
- lea ErrorReq,a1
- move.l d0,es_TextFormat(a1)
- sub.l a0,a0
- sub.l a2,a2
- sub.l a3,a3
- move.l _IntuitionBase,a6
- JSRLIB EasyRequestArgs
-
- Exit jsr Stop6510
- jsr Reset6581 ;Stoppt diesen Lärm!
- jsr ExitSID
- jsr _CloseDisplay
- jsr ExitIEC
-
- move.l _SysBase,a6
-
- move.l RAMBlock,d0
- beq 1$
- move.l d0,a1
- JSRLIB FreeVec
- 1$
- MACHINE 68000
-
- move.l _SysBase,a6
- move.l _TimerBase,d0
- beq NoTimerDev
- lea TimerIO,a1
- JSRLIB CloseDevice
-
- NoTimerDev
- NoCiaRes move.l _SysBase,a6
- move.l _PlaySidBase,d0
- beq NoPlaySid
- move.l d0,a1
- JSRLIB CloseLibrary
-
- NoPlaySid move.l _SID6581Base,d0
- beq NoSID6581
- move.l d0,a1
- JSRLIB CloseLibrary
-
- NoSID6581 move.l _LocaleBase,d0 ;Catalog schließen
- beq NoLocale
- move.l d0,a6
- move.l TheCatalog,a0
- JSRLIB CloseCatalog
- move.l a6,a1
- move.l _SysBase,a6
- JSRLIB CloseLibrary
-
- NoLocale move.l _CyberGfxBase,d0
- beq NoCyber
- move.l d0,a1
- JSRLIB CloseLibrary
-
- NoCyber move.l _IconBase,a1
- JSRLIB CloseLibrary
-
- NoIcon move.l _AslBase,a1
- JSRLIB CloseLibrary
-
- NoAsl move.l _GadToolsBase,a1
- JSRLIB CloseLibrary
-
- NoGadTools move.l _GfxBase,a1
- JSRLIB CloseLibrary
-
- NoGfx move.l _IntuitionBase,a1
- JSRLIB CloseLibrary
-
- NoIntui move.l _UtilityBase,a1
- JSRLIB CloseLibrary
-
- NoUtility moveq #0,d0
- rts
-
- MACHINE 68020
-
-
- **
- ** C64 und Floppy zurücksetzen
- **
-
- XDEF _ResetC64
- _ResetC64
- ResetC64 jsr Reset6510
- jsr Reset6526
- jmp Reset6581
-
-
- **
- ** Je nach Zustand von FastReset den Speichertest aus dem ROM entfernen
- **
-
- PatchReset move.l TheKernal,a0
- tst.w FastReset
- bne 1$
- move.w #$d0e8,$1d84(a0)
- rts
- 1$ move.w #$a000,$1d84(a0)
- rts
-
-
- **
- ** Preferences
- **
-
- *
- * Preferences aus dem Emulator heraus
- *
-
- ; Aktuelle Preferences holen
- _ShowPrefs movem.l d2-d7/a2-a6,-(sp)
- bsr GetPrefs
-
- ; Fenster öffnen und handhaben
- move.w #-1,PrefsFromEmul
- pea ThePrefs
- jsr _DoThePrefs
- addq.l #4,sp
-
- ; Prefs setzen, wenn OK geklickt
- tst.l d0
- beq 1$ ;Die stehen hier (und nicht in SetPrefs),
- jsr ChangedIECPrefs ; weil beim ersten Aufruf von SetPrefs
- bsr IECErrorReq ; noch nicht alles initialisiert ist
- bsr SetPrefs
- jsr ChangedSIDPrefs
- bsr PatchReset
- 1$ movem.l (sp)+,d2-d7/a2-a6
- rts
-
- *
- * Einstellungen setzen
- *
-
- SetPrefs move.w PNormalCycles,NormalCycles
- move.w PBadLineCycles,BadLineCycles
- move.w PCIACycles,CIACycles
- move.w PJoystick1On,Joystick1On
- move.w PJoystick2On,Joystick2On
- move.w PJoystickSwap,JoystickSwap
- move.w PDrv8Type,Drv8Type
- move.w PDrv9Type,Drv9Type
- move.w PDrv10Type,Drv10Type
- move.w PDrv11Type,Drv11Type
- move.w POtherIEC,OtherIEC
- move.w PCollisions,Collisions
- move.w POverscan,Overscan
- move.w PMapSlash,MapSlash
- move.w PFastReset,FastReset
- move.w PLimitSpeed,LimitSpeed
-
- move.w PSkipLatch,SkipLatch
- bne 2$
- move.w #1,SkipLatch ;Keine Null zulassen
- 2$
- tst.w PrefsFromEmul
- bne 1$
- move.l PDisplayID,DisplayID ;Nur beim Start
- move.w PScreenType,ScreenType
- move.w PDirectVideo,DirectVideo
- 1$
- lea PDir8,a0
- lea Dir8,a1
- moveq #256/4-1,d0
- 11$ move.l (a0)+,(a1)+
- dbra d0,11$
-
- lea PDir9,a0
- lea Dir9,a1
- moveq #256/4-1,d0
- 12$ move.l (a0)+,(a1)+
- dbra d0,12$
-
- lea PDir10,a0
- lea Dir10,a1
- moveq #256/4-1,d0
- 13$ move.l (a0)+,(a1)+
- dbra d0,13$
-
- lea PDir11,a0
- lea Dir11,a1
- moveq #256/4-1,d0
- 14$ move.l (a0)+,(a1)+
- dbra d0,14$
-
- move.w PSIDType,SIDType
-
- move.w PKeyboardYZ,KeyboardYZ
- jmp ChangedKeys
-
-
- *
- * Einstellungen holen
- *
-
- GetPrefs move.w NormalCycles,PNormalCycles
- move.w BadLineCycles,PBadLineCycles
- move.w CIACycles,PCIACycles
- move.w Joystick1On,PJoystick1On
- move.w Joystick2On,PJoystick2On
- move.w JoystickSwap,PJoystickSwap
- move.w SIDType,PSIDType
- move.w Drv8Type,PDrv8Type
- move.w Drv9Type,PDrv9Type
- move.w Drv10Type,PDrv10Type
- move.w Drv11Type,PDrv11Type
- move.w OtherIEC,POtherIEC
- move.w KeyboardYZ,PKeyboardYZ
- move.w Collisions,PCollisions
- move.w Overscan,POverscan
- move.w MapSlash,PMapSlash
- move.w FastReset,PFastReset
- move.w LimitSpeed,PLimitSpeed
- move.w DirectVideo,PDirectVideo
- move.l DisplayID,PDisplayID
- move.w ScreenType,PScreenType
- move.w SkipLatch,PSkipLatch
-
- lea Dir8,a0
- lea PDir8,a1
- moveq #256/4-1,d0
- 11$ move.l (a0)+,(a1)+
- dbra d0,11$
-
- lea Dir9,a0
- lea PDir9,a1
- moveq #256/4-1,d0
- 12$ move.l (a0)+,(a1)+
- dbra d0,12$
-
- lea Dir10,a0
- lea PDir10,a1
- moveq #256/4-1,d0
- 13$ move.l (a0)+,(a1)+
- dbra d0,13$
-
- lea Dir11,a0
- lea PDir11,a1
- moveq #256/4-1,d0
- 14$ move.l (a0)+,(a1)+
- dbra d0,14$
- rts
-
-
- **
- ** Requester entsprechend dem Rückgabewert von InitIEC/ChangedIECPrefs anzeigen
- ** d0: Rückgabewert
- **
-
- IECErrorReq tst.l d0
- beq 1$
- cmp.l #1,d0
- bne 2$
- lea NoParPortReq,a1
- bra 3$
- 2$ lea NoTimerReq,a1
- 3$ move.l a6,-(sp)
- move.l _IntuitionBase,a6
- sub.l a0,a0
- move.l a0,a2
- move.l a0,a3
- JSRLIB EasyRequestArgs
- move.l (sp)+,a6
- 1$ rts
-
-
- **
- ** Zufallsbyte ermitteln (0..255)
- ** d0: Ergebnis als 32-Bit-Wert (MSW muß Null sein!)
- **
-
- Random move.l RandomSeed,d1
- mulu.l #2311,d1
- add.l #25367,d1
- divul.l #120050,d0:d1 ;Rest nach d0
- move.l d0,RandomSeed
- lsl.l #8,d0
- divu.l #120050,d0
- rts
-
-
- **
- ** Strings in Datenstrukturen lokalisieren
- **
-
- GetStr MACRO ;Label
- lea TheLocale,a0
- move.l #\1,d0
- jsr GetString
- ENDM
-
- Localize GetStr MSG_REQTITLE
- move.l d0,ErrorReq+es_Title
- move.l d0,NoParPortReq+es_Title
- move.l d0,NoTimerReq+es_Title
-
- GetStr MSG_REQGADS
- move.l d0,ErrorReq+es_GadgetFormat
-
- GetStr MSG_REQGADS2
- move.l d0,NoParPortReq+es_GadgetFormat
- move.l d0,NoTimerReq+es_GadgetFormat
-
- GetStr MSG_NOPARPORT
- move.l d0,NoParPortReq+es_TextFormat
-
- GetStr MSG_NOTIMER
- move.l d0,NoTimerReq+es_TextFormat
- rts
-
-
- **
- ** C-Support (da ohne c.lib gelinkt wird)
- **
-
- XDEF __mulu
- __mulu mulu.l d1,d0
- rts
-
- XDEF __muls
- __muls muls.l d1,d0
- rts
-
- XDEF __divu
- __divu divu.l d1,d0
- rts
-
- XDEF __divs
- __divs divs.l d1,d0
- rts
-
- XDEF _memset ;Dest, Char, Len -> Dest
- _memset move.l 4(sp),a0
- move.l 8(sp),d0
- move.l 12(sp),d1
- beq 1$
- 2$ move.b d0,(a0)+
- subq.l #1,d1
- bne 2$
- 1$ move.l 4(sp),d0
- rts
-
- XDEF _strcat ;Dest, Source -> Dest
- _strcat move.l 4(sp),d0
- move.l d0,a0
- move.l 8(sp),a1
- 1$ tst.b (a0)+
- bne 1$
- subq.l #1,a0
- 2$ move.b (a1)+,(a0)+
- bne 2$
- rts
-
- XDEF _strncat ;Dest, Source, Max -> Dest
- _strncat move.l 4(sp),d0
- move.l d0,a0
- move.l 8(sp),a1
- move.l 12(sp),d1
- beq 1$
- 2$ tst.b (a0)+
- bne 2$
- subq.l #1,a0
- 3$ move.b (a1)+,(a0)+
- beq 1$
- subq.l #1,d1
- bne 3$
- clr.b (a0)
- 1$ rts
-
- XDEF _strchr ;String, Char -> First
- _strchr move.l 4(sp),a0
- move.l 8(sp),d0
- 2$ cmp.b (a0),d0
- beq 1$
- tst.b (a0)+
- bne 2$
- moveq #0,d0
- rts
- 1$ move.l a0,d0
- rts
-
- XDEF _strrchr ;String, Char -> Last
- _strrchr move.l 4(sp),a0
- move.l 8(sp),d1
- moveq #0,d0
- 2$ cmp.b (a0),d1
- bne 1$
- move.l a0,d0
- 1$ tst.b (a0)+
- bne 2$
- rts
-
- XDEF _strcpy ;Dest, Source -> Dest
- _strcpy move.l 4(sp),d0
- move.l d0,a0
- move.l 8(sp),a1
- 1$ move.b (a1)+,(a0)+
- bne 1$
- rts
-
- XDEF _strncpy ;Dest, Source, Max -> Dest
- _strncpy move.l 4(sp),d0
- move.l d0,a0
- move.l 8(sp),a1
- move.l 12(sp),d1
- 2$ subq.l #1,d1
- bcs 1$
- move.b (a1)+,(a0)+
- bne 2$
- bra 3$
- 4$ clr.b (a0)+
- 3$ subq.l #1,d1
- bcc 4$
- 1$ rts
-
- XDEF _strlen ;String
- _strlen move.l 4(sp),a0
- 1$ tst.b (a0)+
- bne 1$
- sub.l 4(sp),a0
- move.l a0,d0
- subq.l #1,d0
- rts
-
- XDEF _malloc ;ByteSize
- _malloc move.l 4(sp),d0
- move.l a6,-(sp)
- move.l _SysBase,a6
- move.l #MEMF_PUBLIC,d1
- JSRLIB AllocVec
- move.l (sp)+,a6
- rts
-
- XDEF _free ;Ptr
- _free move.l 4(sp),a1
- move.l a6,-(sp)
- move.l _SysBase,a6
- JSRLIB FreeVec
- move.l (sp)+,a6
- rts
-
- XDEF _GetStr ;MSG_#?
- _GetStr lea TheLocale,a0
- move.l 4(sp),d0
- jmp GetString
-
- XDEF _PutChProc ;Für RawDoFmt
- _PutChProc move.b d0,(a3)+
- rts
-
-
- **
- ** Konstanten
- **
-
- ; Taglist für OpenCatalog
- CatalogTags dc.l OC_Version,2
- dc.l 0
-
- ; Strings
- Version VERSTAG
- UtilityName dc.b "utility.library",0
- IntuiName dc.b "intuition.library",0
- GfxName dc.b "graphics.library",0
- GadToolsName dc.b "gadtools.library",0
- AslName dc.b "asl.library",0
- IconName dc.b "icon.library",0
- CyberGfxName dc.b "cybergraphics.library",0
- LocaleName dc.b "locale.library",0
- SID6581Name dc.b "6581sid.library",0
- PlaySidName dc.b "playsid.library",0
- CiaResName dc.b "ciaa.resource",0
- MiscResName dc.b "misc.resource",0
- TimerName dc.b "timer.device",0
-
- CatalogName dc.b "Frodo.catalog",0
-
- PrefsDefName dc.b "PROGDIR:Frodo Prefs",0
- BasicFileName dc.b "PROGDIR:Basic ROM",0
- KernalFileName dc.b "PROGDIR:Kernal ROM",0
- CharFileName dc.b "PROGDIR:Char ROM",0
-
- Template dc.b "FILE=PREFSFILE",0
- CNOP 0,4
-
-
- **
- ** Datenbereich
- **
-
- _UtilityBase dc.l 0
- _IntuitionBase dc.l 0
- _GfxBase dc.l 0
- _GadToolsBase dc.l 0
- _AslBase dc.l 0
- _IconBase dc.l 0
- _CyberGfxBase dc.l 0
- _SID6581Base dc.l 0
- _PlaySidBase dc.l 0
- _CiaBase dc.l 0
- _MiscBase dc.l 0
- _TimerBase dc.l 0
-
- TheLocale ;Struktur für GetString
- _LocaleBase dc.l 0
- TheCatalog dc.l 0
-
- MainTask dc.l 0 ;Emulator-Haupttask
-
- RandomSeed dc.l 0 ;Basis für Zufallsgenerator
-
- RAMBlock dc.l 0 ;Zeiger auf Speicherbereich
-
- ; Requester
- ErrorReq dc.l 20,0,0,0,0
- NoParPortReq dc.l 20,0,0,0,0
- NoTimerReq dc.l 20,0,0,0,0
-
-
- **
- ** Nicht initialisierte Daten
- **
-
- SECTION "BSS",BSS
- TimerIO ds.b IOTV_SIZE ;Dummy, um die _TimerBase bekommen
-
- XDEF _PrefsName
- _PrefsName
- PrefsName ds.b 256 ;Puffer für Namen der Prefs-Datei
-
- CLIArgs ;Argumente
- PrefsNameArg ds.l 1
-
- XDEF _PrefsFromEmul
- _PrefsFromEmul
- PrefsFromEmul ds.w 1 ;#0: Einstellungen vom Emulator aus aufgerufen
-
- ; Einstellungen
- ThePrefs
- Pdummy ds.w 1
- PNormalCycles ds.w 1
- PBadLineCycles ds.w 1
- PCIACycles ds.w 1
- PJoystick1On ds.w 1
- PJoystick2On ds.w 1
- PJoystickSwap ds.w 1
- PDisplayID ds.l 1
- PScreenType ds.w 1
- PDir8 ds.b 256
- PDir9 ds.b 256
- PDir10 ds.b 256
- PDir11 ds.b 256
- PDrv8Type ds.w 1
- PDrv9Type ds.w 1
- PDrv10Type ds.w 1
- PDrv11Type ds.w 1
- PSIDType ds.w 1
- POtherIEC ds.w 1
- PKeyboardYZ ds.w 1
- PCollisions ds.w 1
- POverscan ds.w 1
- PMapSlash ds.w 1
- PFastReset ds.w 1
- PSkipLatch ds.w 1
- PLimitSpeed ds.w 1
- PDirectVideo ds.w 1
- PrefsLength = *-ThePrefs
-
- FastReset ds.w 1 ;Prefs: Speichertest bei Reset abschalten
-
- END
-